{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<font color=gray size=4> 2021春 《数据分析》 week01 </font> \n",
    "\n",
    "<font color=gray size=4> 主讲 许智超</font>\n",
    "\n",
    "<font color=gray size=4> 时间：2021.03.03 </font>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "<font color=gray size=6> jupyter notebook键盘快捷键</font>\n",
    "___\n",
    "\n",
    "### 进入命令模式之后（此时你没有活跃单元），你可以尝试以下快捷键：\n",
    "* A 会在活跃单元之上插入一个新的单元，B 会在活跃单元之下插入一个新单元。\n",
    "* 连续按两次 D，可以删除一个单元。\n",
    "* 撤销被删除的单元，按 Z。\n",
    "* Y 会将当前活跃的单元变成一个代码单元。\n",
    "* 按住 Shift +上或下箭头可选择多个单元。在多选模式时，按住 Shift + M 可合并你的选择。\n",
    "* 按 F 会弹出「查找和替换」菜单。\n",
    "___\n",
    "### 处于编辑模式时（在命令模式时按 Enter 会进入编辑模式），你会发现下列快捷键很有用：\n",
    "* Ctrl + Home 到达单元起始位置。\n",
    "* Ctrl + S 保存进度。\n",
    "* 如之前提到的，Ctrl + Enter 会运行你的整个单元块。\n",
    "* Alt + Enter 不止会运行你的单元块，还会在下面添加一个新单元。\n",
    "* Ctrl + Shift + F 打开命令面板。\n",
    "___\n",
    "### 建议大家每次课的笔记、代码、课后练习，以每周形式上传github"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Python 解释器\n",
    "\n",
    "[Python 解释器](https://www.liaoxuefeng.com/wiki/1016959663602400/1016966024263840)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## IPython 基础"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Tab补全  \n",
    "\n",
    "* 变量补全   \n",
    "* 函数/方法补全  \n",
    "* 路径补全\n",
    "* 关键字参数补全"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 变量补全"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "name_age = [\"zhichao_26\",\"Alex_23\",\"Marry_25\",\"Youge_30\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'zhichao': '26', 'Alex': '23', 'Marry': '25', 'Youge': '30'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 例子：di.“<tab>”\n",
    "dict_person = {}\n",
    "#方法1:\n",
    "# 循环\n",
    "# for n in name_age:\n",
    "#     dict_person[n.split('_')[0]] = n.split('_')[1]\n",
    "# dict_person\n",
    "\n",
    "#方法2:\n",
    "#字典推到式\n",
    "dict_person = {n.split('_')[0]:n.split('_')[1] for n in name_age}\n",
    "dict_person"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "-------\n",
    "### * 推导式\n",
    "* <font color=#8470FF size=4> 重点知识：python推导式</font>\n",
    "\n",
    "-------\n",
    "\n",
    "推导式：    \n",
    "* A.数据生成的方式    \n",
    "* B.处理方式\n",
    "\n",
    "> 1.列表(list)推导式\n",
    "```\n",
    "[表达式  for循环] 或者 [表达式  for循环  if条件判断]\n",
    "```\n",
    "> 2.字典(dict)推导式\n",
    "```\n",
    "{ key:value for key,value in existing_data_structure }\n",
    "```\n",
    "> 3.集合(set)推导式\n",
    "```\n",
    "{ expression for item in Sequence if conditional }\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 列表(list)推导式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 4, 9, 16, 25]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# for循环\n",
    "mylist = [1,2,3,4,5]\n",
    "new_list1 = []\n",
    "for i in mylist:\n",
    "    new_list1.append(i*i)\n",
    "new_list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 4, 9, 16, 25]\n",
      "[1, 9, 25]\n"
     ]
    }
   ],
   "source": [
    "# 栗子1   初识推导式\n",
    "new_list2 = [i*i for i in mylist]\n",
    "new_list3 = [i*i for i in mylist if i % 2 !=0]\n",
    "\n",
    "print(new_list2)\n",
    "print(new_list3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0, 3, 6, 9, 12, 15, 18, 21, 24, 27]\n"
     ]
    }
   ],
   "source": [
    "# 栗子2  推导式\n",
    "multiples = [i for i in range(30) if i % 3 == 0]\n",
    "print(multiples)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['driver', '2017-07-13']"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 栗子3  推导式\n",
    "data = ['driver', '2017-07-13', 1827.0, 2058.0, 978.0, 1636.0, 1863.0, 2537.0, 1061.0]\n",
    "[x for x in data if isinstance(x,str)] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[1, 5, 10], [2, 6, 11], [3, 7, 12], [4, 8, 13]]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 栗子4  推导式嵌套\n",
    "matrix = [[1, 2, 3, 4],[5,6,7,8],[10,11,12,13]]\n",
    "\n",
    "[[row[i] for row in matrix] for i in range(4)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(1, 5, 10), (2, 6, 11), (3, 7, 12), (4, 8, 13)]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(*matrix))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 列表推导式小测\n",
    "* 过滤掉长度小于或等于3的字符串列表，并将剩下的转换成大写字母\n",
    "* 生成间隔5分钟的时间列表序列\n",
    "* 求(x,y),其中x是0-5之间的偶数，y是0-5之间的奇数组成的元祖列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ALICE', 'JERRY', 'WENDY', 'SMITH']"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "names = ['Bob','Tom','alice','Jerry','Wendy','Smith']\n",
    "new_names = [name.upper()for name in names if len(name)>3]\n",
    "new_names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['00:00',\n",
       " '00:05',\n",
       " '00:10',\n",
       " '00:15',\n",
       " '00:20',\n",
       " '00:25',\n",
       " '00:30',\n",
       " '00:35',\n",
       " '00:40',\n",
       " '00:45',\n",
       " '00:50',\n",
       " '00:55',\n",
       " '01:00',\n",
       " '01:05',\n",
       " '01:10',\n",
       " '01:15',\n",
       " '01:20',\n",
       " '01:25',\n",
       " '01:30',\n",
       " '01:35',\n",
       " '01:40',\n",
       " '01:45',\n",
       " '01:50',\n",
       " '01:55',\n",
       " '02:00',\n",
       " '02:05',\n",
       " '02:10',\n",
       " '02:15',\n",
       " '02:20',\n",
       " '02:25',\n",
       " '02:30',\n",
       " '02:35',\n",
       " '02:40',\n",
       " '02:45',\n",
       " '02:50',\n",
       " '02:55',\n",
       " '03:00',\n",
       " '03:05',\n",
       " '03:10',\n",
       " '03:15',\n",
       " '03:20',\n",
       " '03:25',\n",
       " '03:30',\n",
       " '03:35',\n",
       " '03:40',\n",
       " '03:45',\n",
       " '03:50',\n",
       " '03:55',\n",
       " '04:00',\n",
       " '04:05',\n",
       " '04:10',\n",
       " '04:15',\n",
       " '04:20',\n",
       " '04:25',\n",
       " '04:30',\n",
       " '04:35',\n",
       " '04:40',\n",
       " '04:45',\n",
       " '04:50',\n",
       " '04:55',\n",
       " '05:00',\n",
       " '05:05',\n",
       " '05:10',\n",
       " '05:15',\n",
       " '05:20',\n",
       " '05:25',\n",
       " '05:30',\n",
       " '05:35',\n",
       " '05:40',\n",
       " '05:45',\n",
       " '05:50',\n",
       " '05:55',\n",
       " '06:00',\n",
       " '06:05',\n",
       " '06:10',\n",
       " '06:15',\n",
       " '06:20',\n",
       " '06:25',\n",
       " '06:30',\n",
       " '06:35',\n",
       " '06:40',\n",
       " '06:45',\n",
       " '06:50',\n",
       " '06:55',\n",
       " '07:00',\n",
       " '07:05',\n",
       " '07:10',\n",
       " '07:15',\n",
       " '07:20',\n",
       " '07:25',\n",
       " '07:30',\n",
       " '07:35',\n",
       " '07:40',\n",
       " '07:45',\n",
       " '07:50',\n",
       " '07:55',\n",
       " '08:00',\n",
       " '08:05',\n",
       " '08:10',\n",
       " '08:15',\n",
       " '08:20',\n",
       " '08:25',\n",
       " '08:30',\n",
       " '08:35',\n",
       " '08:40',\n",
       " '08:45',\n",
       " '08:50',\n",
       " '08:55',\n",
       " '09:00',\n",
       " '09:05',\n",
       " '09:10',\n",
       " '09:15',\n",
       " '09:20',\n",
       " '09:25',\n",
       " '09:30',\n",
       " '09:35',\n",
       " '09:40',\n",
       " '09:45',\n",
       " '09:50',\n",
       " '09:55',\n",
       " '10:00',\n",
       " '10:05',\n",
       " '10:10',\n",
       " '10:15',\n",
       " '10:20',\n",
       " '10:25',\n",
       " '10:30',\n",
       " '10:35',\n",
       " '10:40',\n",
       " '10:45',\n",
       " '10:50',\n",
       " '10:55',\n",
       " '11:00',\n",
       " '11:05',\n",
       " '11:10',\n",
       " '11:15',\n",
       " '11:20',\n",
       " '11:25',\n",
       " '11:30',\n",
       " '11:35',\n",
       " '11:40',\n",
       " '11:45',\n",
       " '11:50',\n",
       " '11:55',\n",
       " '12:00',\n",
       " '12:05',\n",
       " '12:10',\n",
       " '12:15',\n",
       " '12:20',\n",
       " '12:25',\n",
       " '12:30',\n",
       " '12:35',\n",
       " '12:40',\n",
       " '12:45',\n",
       " '12:50',\n",
       " '12:55',\n",
       " '13:00',\n",
       " '13:05',\n",
       " '13:10',\n",
       " '13:15',\n",
       " '13:20',\n",
       " '13:25',\n",
       " '13:30',\n",
       " '13:35',\n",
       " '13:40',\n",
       " '13:45',\n",
       " '13:50',\n",
       " '13:55',\n",
       " '14:00',\n",
       " '14:05',\n",
       " '14:10',\n",
       " '14:15',\n",
       " '14:20',\n",
       " '14:25',\n",
       " '14:30',\n",
       " '14:35',\n",
       " '14:40',\n",
       " '14:45',\n",
       " '14:50',\n",
       " '14:55',\n",
       " '15:00',\n",
       " '15:05',\n",
       " '15:10',\n",
       " '15:15',\n",
       " '15:20',\n",
       " '15:25',\n",
       " '15:30',\n",
       " '15:35',\n",
       " '15:40',\n",
       " '15:45',\n",
       " '15:50',\n",
       " '15:55',\n",
       " '16:00',\n",
       " '16:05',\n",
       " '16:10',\n",
       " '16:15',\n",
       " '16:20',\n",
       " '16:25',\n",
       " '16:30',\n",
       " '16:35',\n",
       " '16:40',\n",
       " '16:45',\n",
       " '16:50',\n",
       " '16:55',\n",
       " '17:00',\n",
       " '17:05',\n",
       " '17:10',\n",
       " '17:15',\n",
       " '17:20',\n",
       " '17:25',\n",
       " '17:30',\n",
       " '17:35',\n",
       " '17:40',\n",
       " '17:45',\n",
       " '17:50',\n",
       " '17:55',\n",
       " '18:00',\n",
       " '18:05',\n",
       " '18:10',\n",
       " '18:15',\n",
       " '18:20',\n",
       " '18:25',\n",
       " '18:30',\n",
       " '18:35',\n",
       " '18:40',\n",
       " '18:45',\n",
       " '18:50',\n",
       " '18:55',\n",
       " '19:00',\n",
       " '19:05',\n",
       " '19:10',\n",
       " '19:15',\n",
       " '19:20',\n",
       " '19:25',\n",
       " '19:30',\n",
       " '19:35',\n",
       " '19:40',\n",
       " '19:45',\n",
       " '19:50',\n",
       " '19:55',\n",
       " '20:00',\n",
       " '20:05',\n",
       " '20:10',\n",
       " '20:15',\n",
       " '20:20',\n",
       " '20:25',\n",
       " '20:30',\n",
       " '20:35',\n",
       " '20:40',\n",
       " '20:45',\n",
       " '20:50',\n",
       " '20:55',\n",
       " '21:00',\n",
       " '21:05',\n",
       " '21:10',\n",
       " '21:15',\n",
       " '21:20',\n",
       " '21:25',\n",
       " '21:30',\n",
       " '21:35',\n",
       " '21:40',\n",
       " '21:45',\n",
       " '21:50',\n",
       " '21:55',\n",
       " '22:00',\n",
       " '22:05',\n",
       " '22:10',\n",
       " '22:15',\n",
       " '22:20',\n",
       " '22:25',\n",
       " '22:30',\n",
       " '22:35',\n",
       " '22:40',\n",
       " '22:45',\n",
       " '22:50',\n",
       " '22:55',\n",
       " '23:00',\n",
       " '23:05',\n",
       " '23:10',\n",
       " '23:15',\n",
       " '23:20',\n",
       " '23:25',\n",
       " '23:30',\n",
       " '23:35',\n",
       " '23:40',\n",
       " '23:45',\n",
       " '23:50',\n",
       " '23:55']"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time = ['%.2d:%.2d'%(h,m )for h in range(24) for m in range(0,60,5) ]\n",
    "time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(0, 1), (0, 3), (2, 1), (2, 3), (4, 1), (4, 3)]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list_array = [(x,y) for x in range(5) if x%2 == 0 for y in range(5) if y%2 == 1]\n",
    "list_array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 以python 期中测试练习：\n",
    "--------\n",
    "\n",
    "* Q4 （20分） 🌶🌶  中\n",
    "* 请找出text中所有\"新媒体\"关键字前面的两个字符"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_excel('all.xls')\n",
    "df_summary = df[\"Summary-摘要\"].fillna(\"NAN\").tolist()\n",
    "text = \"\".join(df_summary) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['术的', '的创', '5G', '我国', '我国', '促进', '我国', '博等', '面对', '发展', '表的', '杂的', '处理', '大学', '述了', '时代', '在和', '且取', '全球', '结了', '全球', '全球', '级,', '全球', '世界', '全球', '来,', '随着', '成为', '以及', '促使', '年的', '然是', '关注', '网、', '展。', '基于', '网络', '化与', '编辑', '移动', '对的', '家。', '体和', '当下', '围绕', '当下', '维革', ',到', '变。', '加快', '利用', '害。', '厘清', '财经', '述。', '合和', '针对', '制到', '改变', '电台', '收录', '中国', '集团', '成为', '才是', '熟悉', '体与', '道的', '战。', ',在', '展,', '。□', '务是', '学\"', '视、', '中国', '中国', '中国', '求。', '随着', '体和', '者在', '国际', '合:', '力的', '大学', '四届', '共论', '来。', '变革', '受到', '、以', '。在', '借助', '校报', '来自', '容的', ',在', '命。', '\",', '也给', '是从', '上,', '对于', '息在', '业在', '显了', '到了', '材,', '体和', '地方', '主流', '地市', '体与', '不开', '今,', '一、', '过对', '述了', '有关', '目前', '作为', '一种', '》的', '告暨', '大学', '届\"', '绕\"', '以\"', '\"与', '利用', '利用', '——', '都与', '入\"', '己的', '通过', '势。', '而,', '其是', '何与', '中国', '中国', '以及', '体和', '络等', '网等', '体、', '化:', ',在', '世界', '面对', '搭上', '应对', ',而', '制定', '相较', '借助', '体在', '网和', '来,', '注。', '在于', '据是', '力是', '。在', '\",', '释了', '出了', '里,', '由对', '出\"', '研究', '。在', '受到', '何在', '渐向', '伴随', '时代', '中国', '中国', '中国', '型。', '走向', '站在', '发展', '数字', '中国', '中国', '中国', '解读', '探析', '中国', '块。', '过与', '届\"', '视听', '办的', '视听', '视听', '视听', '体向', '及,', '大对', '——', '认为', '属于', '对接', '入;', '中,', '统。', '网和', '交网', '晚报', '时代', '端等', '报》', '示出', '能在', '等在', '帮助', '对于', '。在', '政务', '杂,', '运用', '借助', '析等', '道和', ',分', '年,', ',将', '虽然', ',让', '国的', '未来', '民,', '态革', '推动', '括\"', '民,', '态革', '推动', '坚,', '报道', '将与', '点的', '了在', '化,', ',对', '网+', '体和', '成为', '网和', '快与', '。在', '九派', '化。', '体与', '与此', '合、', '通过', '论、', '中国', '新浪', '统,', '站及', '运用', '会,', '运用', '作为', '用创', '路。', '随着', '体的', '鉴。', '来,', '我国', '出了', '后对', '境和', '率;', '下的', '面对', ',在', '报在', '内外', '中国', '当前', '中国', '重塑', '以及', '届\"', '体与', '一些', '度。', '异,', '运用', ',用', '届\"', '学院', '网、', '值。', '促使', '体、', '出以', '探索', '合了', ',在', '政务', '政务', '政务', '还是', '中国', '中国', '中国', '国,', '点。', '共享', '际化', '联网', '各类', '户外', '户外', '伴随', '利用', '随着', '识到', '说,', '表的', '\"从', '度的', '1亿', '的,', ',将', '成为', '建设', '上对', '参与', '提出', '以及', '认识', '展和', '数据', '随着', '体与', '平台', '革,', '业者', '来是', 'K等', '我国', '络与', '发挥', '中国', '我国', '并对', '题。', '代,', ',以', '影视', '借助', '针对', '寻求', '成为', '势。', '述了', '出了', '析、', '体与', '面对', '体和', '体与', '符合', '景。', '官方', '术是', '顺应', '上的', '术、', '前,', '又懂', '加大', '借助', '优化', '现了', '政务', '\"\"', '合化', '司。', '视与', 'KI', '像于', '学生', '强。', '步,', '把握', '网民', '网和', '传统', '展,', '力。', '体与', '艾的', '速。', '异的', '考。', '变成', '\":', '当前', '本。', '着对', '新与', '加快', '述了', '我国', '成的', '我国', '。在', '户和', '春运', '局在', '样。', '各类', '来,', '网络', '异,', '随着', '廓;', '绍了', '找出', '态。', '使得', '件,', '视了', '理解', '进对', '道和', '。《', ',\"', '理了', '需要', '展。', '智能', '。但', '成为', '提升', '日报', '网络', '势对', '并对', '术对', '代,', 'X\"', '今,', '目在', '文对', '效。', '年的', '通过', '年度', '现,', '网和', '中国', '代·', '能、', '新闻', '华社', '实现', '戏等', '长,', '潮,', '探索', '电子', '宽了', '创新', '5G', '政务', '政务', '政务', '政务', '础;', '建、', '鉴于', '根据', '成为', '当下', '置,', '率,', '人,', '要。', '家号', '纷与', '随着', '视听', '议。', '接受', '提在', '中国', '年的', '8年', '文从', '体等', '。在', '正与', '华社', '广电', '明珠', '示着', '块。', '过与', '届\"', '视听', '办的', '视听', '视听', '视听', '体向', '及,', '大对', '——', '认为', '属于', '对接', '入;', '中,', '统。', '网和', '年的', '然是', '关注']\n"
     ]
    }
   ],
   "source": [
    "phrase=\"新媒体\"\n",
    "\n",
    "position_all=[]\n",
    "for i,c in enumerate(text):\n",
    "    if c==phrase[0]:\n",
    "        if i<len(text):\n",
    "            if text[i+1]==phrase[1]:\n",
    "                if  text[i+2]==phrase[2]:\n",
    "                    position_all.append(i)\n",
    "position_all\n",
    "content_all=[]\n",
    "for i in position_all:\n",
    "    content_all.append(text[i-2:i])\n",
    "    \n",
    "print(content_all)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 试一试？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "phrase=\"新媒体\"\n",
    "\n",
    "position_all = [i for i,c in enumerate(text) if c == phrase[0] and i<len(text) and text[i+1]==phrase[1] and text[i+2]==phrase[2]]  \n",
    "position_all\n",
    "content_all=[text[i-2:i] for i in position_all]\n",
    "print(content_all)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 字典(dict)推导式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'import': 0,\n",
       " 'is': 1,\n",
       " 'with': 2,\n",
       " 'if': 3,\n",
       " 'file': 4,\n",
       " 'exception': 5,\n",
       " 'shim': 6,\n",
       " 'lucy': 7}"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 用字典推导式配合枚举的使用案例\n",
    "strings = ['import','is','with','if','file','exception','shim','lucy']\n",
    "dict_enu = {k:v for v,k in enumerate(strings)}\n",
    "dict_enu"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: 'import',\n",
       " 1: 'is',\n",
       " 2: 'with',\n",
       " 3: 'if',\n",
       " 4: 'file',\n",
       " 5: 'exception',\n",
       " 6: 'shim',\n",
       " 7: 'lucy'}"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 互换key和value的值\n",
    "dict_enu_reverse = {k:v for v,k in dict_enu.items()}\n",
    "dict_enu_reverse"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 字典推导式小测\n",
    "\n",
    "* 我们有一个fruit的list，现在想要得到每一种水果的单词长度\n",
    "* 源数据的key是字母的大小写混在一起，我们想统计同一个字母（不论大小写）的key所对应的键值对的和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'apple': 5, 'orange': 6, 'banana': 6, 'mango': 5, 'peach': 5}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fruits = ['apple','orange','banana','mango','peach']\n",
    "fruits_dict = {fruit:len(fruit) for fruit in fruits}\n",
    "fruits_dict\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'a': 15, 'b': 23, 'd': 4}"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums = {'a':10,'b':20,'A':5,'B':3,'d':4}\n",
    "num_frequency  = {k.lower():nums.get(k.lower(),0) + nums.get(k.upper(),0)\n",
    "                  for k in nums.keys() }\n",
    "num_frequency"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### 以python期中测试练习为例\n",
    "-------\n",
    "\n",
    "* Q5 （20分） 🌶🌶  中\n",
    "* 统计text中所有\"新媒体\"关键字前面的两个字符的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'术的': 1, '的创': 1, '5G': 2, '我国': 8, '促进': 1, '博等': 1, '面对': 4, '发展': 2, '表的': 2, '杂的': 1, '处理': 1, '大学': 3, '述了': 4, '时代': 3, '在和': 1, '且取': 1, '全球': 5, '结了': 1, '级,': 1, '世界': 2, '来,': 4, '随着': 7, '成为': 7, '以及': 4, '促使': 2, '年的': 4, '然是': 2, '关注': 2, '网、': 2, '展。': 2, '基于': 1, '网络': 3, '化与': 1, '编辑': 1, '移动': 1, '对的': 1, '家。': 1, '体和': 6, '当下': 3, '围绕': 1, '维革': 1, ',到': 1, '变。': 1, '加快': 2, '利用': 4, '害。': 1, '厘清': 1, '财经': 1, '述。': 1, '合和': 1, '针对': 2, '制到': 1, '改变': 1, '电台': 1, '收录': 1, '中国': 22, '集团': 1, '才是': 1, '熟悉': 1, '体与': 8, '道的': 1, '战。': 1, ',在': 5, '展,': 2, '。□': 1, '务是': 1, '学\"': 1, '视、': 1, '求。': 1, '者在': 1, '国际': 1, '合:': 1, '力的': 1, '四届': 1, '共论': 1, '来。': 1, '变革': 1, '受到': 2, '、以': 1, '。在': 7, '借助': 5, '校报': 1, '来自': 1, '容的': 1, '命。': 1, '\",': 2, '也给': 1, '是从': 1, '上,': 1, '对于': 2, '息在': 1, '业在': 1, '显了': 1, '到了': 1, '材,': 1, '地方': 1, '主流': 1, '地市': 1, '不开': 1, '今,': 2, '一、': 1, '过对': 1, '有关': 1, '目前': 1, '作为': 2, '一种': 1, '》的': 1, '告暨': 1, '届\"': 5, '绕\"': 1, '以\"': 1, '\"与': 1, '——': 3, '都与': 1, '入\"': 1, '己的': 1, '通过': 3, '势。': 2, '而,': 1, '其是': 1, '何与': 1, '络等': 1, '网等': 1, '体、': 2, '化:': 1, '搭上': 1, '应对': 1, ',而': 1, '制定': 1, '相较': 1, '体在': 1, '网和': 6, '注。': 1, '在于': 1, '据是': 1, '力是': 1, '释了': 1, '出了': 3, '里,': 1, '由对': 1, '出\"': 1, '研究': 1, '何在': 1, '渐向': 1, '伴随': 2, '型。': 1, '走向': 1, '站在': 1, '数字': 1, '解读': 1, '探析': 1, '块。': 2, '过与': 2, '视听': 9, '办的': 2, '体向': 2, '及,': 2, '大对': 2, '认为': 2, '属于': 2, '对接': 2, '入;': 2, '中,': 2, '统。': 2, '交网': 1, '晚报': 1, '端等': 1, '报》': 1, '示出': 1, '能在': 1, '等在': 1, '帮助': 1, '政务': 9, '杂,': 1, '运用': 4, '析等': 1, '道和': 2, ',分': 1, '年,': 1, ',将': 2, '虽然': 1, ',让': 1, '国的': 1, '未来': 1, '民,': 2, '态革': 2, '推动': 2, '括\"': 1, '坚,': 1, '报道': 1, '将与': 1, '点的': 1, '了在': 1, '化,': 1, ',对': 1, '网+': 1, '快与': 1, '九派': 1, '化。': 1, '与此': 1, '合、': 1, '论、': 1, '新浪': 1, '统,': 1, '站及': 1, '会,': 1, '用创': 1, '路。': 1, '体的': 1, '鉴。': 1, '后对': 1, '境和': 1, '率;': 1, '下的': 1, '报在': 1, '内外': 1, '当前': 2, '重塑': 1, '一些': 1, '度。': 1, '异,': 2, ',用': 1, '学院': 1, '值。': 1, '出以': 1, '探索': 2, '合了': 1, '还是': 1, '国,': 1, '点。': 1, '共享': 1, '际化': 1, '联网': 1, '各类': 2, '户外': 2, '识到': 1, '说,': 1, '\"从': 1, '度的': 1, '1亿': 1, '的,': 1, '建设': 1, '上对': 1, '参与': 1, '提出': 1, '认识': 1, '展和': 1, '数据': 1, '平台': 1, '革,': 1, '业者': 1, '来是': 1, 'K等': 1, '络与': 1, '发挥': 1, '并对': 2, '题。': 1, '代,': 2, ',以': 1, '影视': 1, '寻求': 1, '析、': 1, '符合': 1, '景。': 1, '官方': 1, '术是': 1, '顺应': 1, '上的': 1, '术、': 1, '前,': 1, '又懂': 1, '加大': 1, '优化': 1, '现了': 1, '\"\"': 1, '合化': 1, '司。': 1, '视与': 1, 'KI': 1, '像于': 1, '学生': 1, '强。': 1, '步,': 1, '把握': 1, '网民': 1, '传统': 1, '力。': 1, '艾的': 1, '速。': 1, '异的': 1, '考。': 1, '变成': 1, '\":': 1, '本。': 1, '着对': 1, '新与': 1, '成的': 1, '户和': 1, '春运': 1, '局在': 1, '样。': 1, '廓;': 1, '绍了': 1, '找出': 1, '态。': 1, '使得': 1, '件,': 1, '视了': 1, '理解': 1, '进对': 1, '。《': 1, ',\"': 1, '理了': 1, '需要': 1, '智能': 1, '。但': 1, '提升': 1, '日报': 1, '势对': 1, '术对': 1, 'X\"': 1, '目在': 1, '文对': 1, '效。': 1, '年度': 1, '现,': 1, '代·': 1, '能、': 1, '新闻': 1, '华社': 2, '实现': 1, '戏等': 1, '长,': 1, '潮,': 1, '电子': 1, '宽了': 1, '创新': 1, '础;': 1, '建、': 1, '鉴于': 1, '根据': 1, '置,': 1, '率,': 1, '人,': 1, '要。': 1, '家号': 1, '纷与': 1, '议。': 1, '接受': 1, '提在': 1, '8年': 1, '文从': 1, '体等': 1, '正与': 1, '广电': 1, '明珠': 1, '示着': 1}\n"
     ]
    }
   ],
   "source": [
    "found = {}\n",
    "found = found.fromkeys(content_all,0)\n",
    "for i in content_all:\n",
    "    if i in content_all:\n",
    "        found[i]+=1\n",
    "print(found)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 试一试？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* Q6 （20分） 🌶 🌶 🌶 稍难\n",
    "* 找出text中所有\"新媒体\"关键字前面的两个字符的次数排在前五的关键词，作为一个新的字典输出"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 试一试？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 函数/方法补全"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.timedelta(days=76)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "today =datetime.date.today()\n",
    "sub = datetime.date(2021,5,4)\n",
    "sub.__sub__(today)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6238 days, 0:00:00\n",
      "2020-01-03\n",
      "20/01/03\n"
     ]
    }
   ],
   "source": [
    "# 两个日期相差多少天\n",
    "date_nCoV = datetime.date(2020,1,3)\n",
    "date_SARS = datetime.date(2002,12,5)\n",
    "print(date_nCoV.__sub__(date_SARS))\n",
    "# 格式化输出日期\n",
    "\n",
    "print(date_nCoV.strftime(\"%Y-%m-%d\"))\n",
    "print(date_nCoV.strftime(\"%y/%m/%d\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 内省  \n",
    "* 在一个变量名前后使用（？）显示概要信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a = [1,2,3]\n",
    "?list_a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def add_numbers(a,b):\n",
    "    \"\"\"\n",
    "    add two numbers together\n",
    "    Returns\n",
    "    -----\n",
    "    the_sum :type of args\n",
    "    \"\"\"\n",
    "    return a+b\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 两个问号可以显示函数源代码\n",
    "add_numbers??"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 试一试\n",
    "datetime??"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 606 µs, sys: 1.09 ms, total: 1.69 ms\n",
      "Wall time: 3.01 s\n"
     ]
    }
   ],
   "source": [
    "%time time.sleep(3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### %run命令 \n",
    "* 可在jupuyter 中执行.py文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n"
     ]
    }
   ],
   "source": [
    "%run hello.py"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### jupyter魔术命令  \n",
    "* https://www.cnblogs.com/bind/p/11958317.html"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "url = (\"https://www.cnblogs.com/bind/p/11958317.html\")\n",
    "magic_df = pd.read_html(url)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(magic_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "#python 颜色： \\033[显示方式;前景色;背景色m + 结尾部分：\\033[0m \n",
    "#显示方式: 0（默认\\）、1（高亮）、22（非粗体）、4（下划线）、24（非下划线）、 5（闪烁）、25（非闪烁）、7（反显）、27（非反显）\n",
    "#前景色:   30（黑色）、31（红色）、32（绿色）、 33（黄色）、34（蓝色）、35（洋 红）、36（青色）、37（白色）\n",
    "#背景色:   40（黑色）、41（红色）、42（绿色）、 43（黄色）、44（蓝色）、45（洋 红）、46（青色）、47（白色）\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1;31m魔术命令-Line magics\u001b[0m\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>命令</th>\n",
       "      <th>详情</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>%alias</td>\n",
       "      <td>定义别名</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>%alias_magic</td>\n",
       "      <td>为现有的魔术命令创建别名</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>%autocall</td>\n",
       "      <td>%autocall</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>%automagic</td>\n",
       "      <td>设置输入魔术命令时是否键入%前缀，on(1)/off(0)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>%bookmark</td>\n",
       "      <td>管理IPython的书签系统</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>%cd</td>\n",
       "      <td>更改当前工作目录</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>%colors</td>\n",
       "      <td>%colors</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>%config</td>\n",
       "      <td>%config</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>%debug</td>\n",
       "      <td>%debug</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>%dhist</td>\n",
       "      <td>打印历史访问目录</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>%dirs</td>\n",
       "      <td>返回当前目录堆栈</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>%doctest_mode</td>\n",
       "      <td>%doctest_mode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>%edit</td>\n",
       "      <td>%edit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>%env</td>\n",
       "      <td>设置环境变量(无需重启)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>%gui</td>\n",
       "      <td>%gui</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>%history</td>\n",
       "      <td>%history</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>%killbgscripts</td>\n",
       "      <td>%killbgscripts</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>%load</td>\n",
       "      <td>导入python文件</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>%load_ext</td>\n",
       "      <td>%load_ext</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>%loadpy</td>\n",
       "      <td>%load别名</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>%logoff</td>\n",
       "      <td>临时停止logging</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>%logon</td>\n",
       "      <td>重新开始logging</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>%logstart</td>\n",
       "      <td>%logstart</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>%logstate</td>\n",
       "      <td>%logstate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>%lsmagic</td>\n",
       "      <td>列出当前可用的魔术命令。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>%macro</td>\n",
       "      <td>定义用来重复执行的宏</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>%magic</td>\n",
       "      <td>显示魔术命令的帮助</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>%matplotlib</td>\n",
       "      <td>设置matplotlib的工作方式</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>%notebook</td>\n",
       "      <td>%notebook</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>%page</td>\n",
       "      <td>%page</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>%pastebin</td>\n",
       "      <td>%pastebin</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>%pdb</td>\n",
       "      <td>控制pdb交互式调试器的自动调用</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                命令                             详情\n",
       "0           %alias                           定义别名\n",
       "1     %alias_magic                   为现有的魔术命令创建别名\n",
       "2        %autocall                      %autocall\n",
       "3       %automagic  设置输入魔术命令时是否键入%前缀，on(1)/off(0)\n",
       "4        %bookmark                 管理IPython的书签系统\n",
       "5              %cd                       更改当前工作目录\n",
       "6          %colors                        %colors\n",
       "7          %config                        %config\n",
       "8           %debug                         %debug\n",
       "9           %dhist                       打印历史访问目录\n",
       "10           %dirs                       返回当前目录堆栈\n",
       "11   %doctest_mode                  %doctest_mode\n",
       "12           %edit                          %edit\n",
       "13            %env                   设置环境变量(无需重启)\n",
       "14            %gui                           %gui\n",
       "15        %history                       %history\n",
       "16  %killbgscripts                 %killbgscripts\n",
       "17           %load                     导入python文件\n",
       "18       %load_ext                      %load_ext\n",
       "19         %loadpy                        %load别名\n",
       "20         %logoff                    临时停止logging\n",
       "21          %logon                    重新开始logging\n",
       "22       %logstart                      %logstart\n",
       "23       %logstate                      %logstate\n",
       "24        %lsmagic                   列出当前可用的魔术命令。\n",
       "25          %macro                     定义用来重复执行的宏\n",
       "26          %magic                      显示魔术命令的帮助\n",
       "27     %matplotlib              设置matplotlib的工作方式\n",
       "28       %notebook                      %notebook\n",
       "29           %page                          %page\n",
       "30       %pastebin                      %pastebin\n",
       "31            %pdb               控制pdb交互式调试器的自动调用"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(\"\\033[1;31m魔术命令-Line magics\\033[0m\")\n",
    "magic_df[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 尝试练习其他表格\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 本周作业"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* A.pandas预习 \n",
    "> 1.Pandas_Cheat_Sheet.pdf          \n",
    "> 2.[pandas官网](https://pandas.pydata.org)      \n",
    "> 3.[10 minutes to pandas](https://pandas.pydata.org/docs/user_guide/10min.html)\n",
    "-----\n",
    "* B.练习python推导式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
